package org.example.lawyermanager.dongao.service;

import org.example.lawyermanager.dongao.entity.Lawyer;
import org.example.lawyermanager.dongao.mapper.LawyerMapper;
import org.example.lawyermanager.dongao.service.LawyerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 律师档案业务接口实现类
 * @author yangwenhan
 * @version 1.0
 */
@Service
public class LawyerServiceImpl implements LawyerService {

    @Autowired
    LawyerMapper lawyerMapper;

    /**
     * 根据律师编号删除律师信息
     *
     * @param lawyerid 律师编号
     * @return 删除成功返回1，否则返回0
     */
    @Override
    public int removeLawyer(int lawyerid) {
        return lawyerMapper.deleteLawyer(lawyerid);
    }

    /**
     * 查询所有律师
     * @return 律师集合
     */
    @Override
    public List<Lawyer> findLawyer() {
        return lawyerMapper.selectLawyer();
    }

    /**
     * 添加律师
     * @param lawyer 律师对象
     * @return 添加成功返回1，否则返回0
     */
    @Override
    public int addLawyer(Lawyer lawyer) {
        return lawyerMapper.insertLawyer(lawyer);
    }
}